package tungsten;

import tungsten.base.event.Event;
import tungsten.base.event.SingleEventDispatcher;
import tungsten.base.event.EventBus;

/**
 * Created by Lv on 2016/6/15.
 */
public class Client1 {

    public static void main(String[] args) throws Exception
    {
        //new Client().connect(8090);
        new Client1();
    }
    public Client1() throws Exception
    {
        ED ed = new ED();

        for(int i = 0;i<1000;i++)
        {
            EventBus.dispatchEvent(new Event(0,i));
            Thread.sleep(100);
        }
    }

    private class ED extends SingleEventDispatcher
    {
        public ED()
        {
            this.addEventListener(0, event -> {
                System.out.println(event.getParam(0));
                Thread.sleep(5);
            });
        }
    }
}
